package com.tonghe.dao;

import com.tonghe.pojo.User;
import com.tonghe.utils.MybatisUtils;
import org.apache.ibatis.session.SqlSession;
import org.junit.Test;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Date:2021/12/18- 12- 18- 13:25
 **/
public class UserDao {

    @Test
    public void getUserByLimit(){
        SqlSession sqlSession = MybatisUtils.getSqlSession();
        UserMapper mapper = sqlSession.getMapper(UserMapper.class);

        Map<String, Object> map = new HashMap<>();
        map.put("startIndex",2);
        map.put("pageSize",2);

        List<User> userList = mapper.getUserByLimit(map);
        for (User user:userList) {
            System.out.println(user);
        }

        sqlSession.close();
    }

}
